<script type="text/javascript" >
    stSocialMediaToolbox.load_tooltip();
    stSocialMediaToolboxCustom.on_submitform_new('#stFacebookToolboxForm');
    stSocialMediaToolbox.loadUploadButton('200');
    stSocialMediaToolbox.loadRemoveButton();
    jQuery(document).ready(function(){
            var amount = new Array();
            amount[1] = 'Fixed monthly fee amount:';
            amount[2] = 'Fixed fee per sale amount:';
            amount[3] = 'Percentage amount:';
        jQuery('#activated').datepicker({"dateFormat":"dd.mm.yy"});
        jQuery('#expire').datepicker({"dateFormat":"dd.mm.yy"}); 
        jQuery('#amount').html(amount[jQuery("#revenue").val()]);
        jQuery("#revenue").change(function(){
            if(jQuery(this).val() == '3'){
                jQuery("#display_currency").slideUp();
            }
            else {
                jQuery("#display_currency").slideDown();
            }
        })
    });
    var amount = new Array();
    amount[1] = 'Fixed monthly fee amount:';
    amount[2] = 'Fixed fee per sale amount:';
    amount[3] = 'Percentage amount:';
</script>
<?php 
            if(count($contract_result) > 0){
            $activated = explode('-',$contract_result->activated);
            $activated = $activated[2].'.'.$activated[1].'.'.$activated[0];
            $expire = explode('-',$contract_result->expire);
            $expire = $expire[2].'.'.$expire[1].'.'.$expire[0];
            }
            else {
               $activated = ''; 
               $expire = '';
            }
?>
<div class="w100p bgl">
    <div class="w100p bgr p5b">
        <form class="stform" id="stFacebookToolboxForm" action="<?php echo admin_url('/admin.php?page=' . $config['plugin_name'] . '&action=' . $current_action) ?>" method="post" >
            <ul>
                <li>
                    <label><?php _e('Client name', $config['plugin_name']); ?>:</label>
                    <div class="required">
                        <input value="<?php echo $company_info[0]['company_name'];?>" disabled="true" class="required" name="data[searchterm]" id="searchterm" type="text"  />
                        <input type="hidden" name="data[user_id]" id="user_id" value="<?php echo $user_id;?>" />
                    </div>
                    <br clear="both" />
                </li>
                <li>
                    <label><?php _e('Application activated date', $config['plugin_name']); ?>:</label>
                    <div class="">
                        <input value="<?php echo $activated;?>" class="" name="data[activated]" id="activated" type="text"  />
                    </div>
                    <br clear="both" />
                </li>
                <li>
                    <label><?php _e('Contract expire date', $config['plugin_name']); ?>:</label>
                    <div class="">
                        <input value="<?php echo $expire;?>" class="" name="data[expire]" id="expire" type="text"  />
                    </div>
                    <br clear="both" />
                </li>
                <li>
                    <label><?php _e('Revenue type', $config['plugin_name']); ?>:</label>
                    <div class="required">
                        <select name="data[revenue]" id="revenue" onchange="jQuery('#amount').html(amount[this.value])">
                            <option value="1" <?php if($contract_result->type == 1){echo 'selected';}?> >Fixed monthly fee</option>
                            <option value="2" <?php if($contract_result->type == 2){echo 'selected';}?> >Fixed fee per sale</option>
                            <option value="3"<?php if($contract_result->type == 3){echo 'selected';}?> >Percentage of sale</option>
                        </select>
                    </div>
                    <br clear="both" />
                </li>
                <li>
                    <label id="amount"><?php _e('Fixed monthly fee', $config['plugin_name']); ?>:</label>
                    <div class="required">
                        <input type="text" value="<?php echo $contract_result->amount;?>" class="required" name="data[fee]" id="fee" />
                    </div>
                    <br clear="both" />
                </li>
                <li <?php if($contract_result->type == 3){echo 'style="display:none;"';}?> id="display_currency">
                    <label id="amount"><?php _e('Currency', $config['plugin_name']); ?>:</label>
                    <div class="required">
                        <select name="data[currency]" id="currency">
                            <option value="nok" <?php if($contract_result->currency == 'nok'){echo 'selected';}?> >NOK</option>
                            <option value="sek" <?php if($contract_result->currency == 'sek'){echo 'selected';}?> >SEK</option>
                            <option value="dkk" <?php if($contract_result->currency == 'dkk'){echo 'selected';}?> >DKK</option>
                            <option value="eur" <?php if($contract_result->currency == 'eur'){echo 'selected';}?> >EUR</option>
                            <option value="usd" <?php if($contract_result->currency == 'usd'){echo 'selected';}?> >USD</option>
                            <option value="gbp" <?php if($contract_result->currency == 'gbp'){echo 'selected';}?> >GBP</option>
                            <option value="thb" <?php if($contract_result->currency == 'thb'){echo 'selected';}?> >THB</option>
                            <option value="vnd" <?php if($contract_result->currency == 'vnd'){echo 'selected';}?> >VND</option>
                        </select>
                    </div>
                    <br clear="both" />
                </li>
                <li>
                    <label><?php _e('Contract notes', $config['plugin_name']); ?>:</label>
                    <div class="">
                       <textarea name="data[contract]" id="contract" ><?php echo $contract_result->contract;?></textarea>
                    </div>
                    <br clear="both" />
                </li>
               <li>
                    <input type="submit" value="Save"/>
                </li>

          
            </ul>
           
        </form>
    </div>
</div>